#!/bin/bash
pushd ../

#Clean up the terrain from old packages:
rm -f -r binaries

#Create a directory to put our .ane and change to it:
mkdir binaries
pushd binaries

#Declare some variables:
#on Mac:
adt_directory="/Applications/Adobe Flash Builder 4.6/sdks/4.6.0/bin"

native_code_directory="../EmailExtension/iOS/EmailExtensionIOS"

library_directory="../FlexEmailLib"

dest_ANE="../binaries/NativeEmailExtensionLib.ane"

extension_XML=extension.xml

library_SWC=NativeMailExtensionLib.swc



#Copy the ingredients for the package:
cp -f "${native_code_directory}"/build/Debug-iphoneos/libEmailExtensionIOS.a .
cp -f "${library_directory}"/src/*.xml .
cp -f "${library_directory}"/bin/*.swc .

unzip -o "${library_SWC}"


#Make the package:
"${adt_directory}"/adt -package -target ane "${dest_ANE}" "${extension_XML}" -swc "${library_SWC}" -platform iPhone-ARM -C . . -platformoptions ios-platformoptions.xml


#Clean up the stuff that's already gone into the package and we don't need any more:
rm -f *.a
rm -f *.xml
rm -f *.swc
rm -f *.swf

popd
popd




